package Ventanas.usuario;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import util.GetFrame;

public class PanelLocalizacion extends JPanel implements ActionListener {
	private javax.swing.JButton bAtras;
	private javax.swing.JButton bLoc;
	private JLabel fondo;

	public PanelLocalizacion() {
		bLoc = new javax.swing.JButton();
		bAtras = new javax.swing.JButton();
		fondo = new JLabel();
		setLayout(null);
		bLoc.setFont(new java.awt.Font("Comic Sans MS", 0, 14));
		bLoc.setText("Obtener localizacion");
		add(bLoc);
		bLoc.setBounds(322, 246, 200, 40);
		bLoc.addActionListener(this);
		bAtras.setFont(new java.awt.Font("Comic Sans MS", 0, 14));
		bAtras.setText("Atras");
		add(bAtras);
		bAtras.setBounds(100, 480, 80, 30);
		bAtras.addActionListener(this);
		this.setBackground(new Color(3, 41, 51));
		fondo.setIcon(new ImageIcon("src/resources/onda.png"));
		add(fondo);
		fondo.setBounds(155, 10, 516, 290);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Ventana ventana = GetFrame.getVentana(this);
		if (e.getSource() == (bAtras)) {
			this.setVisible(false);
			PanelMenu panel = new PanelMenu();
			ventana.getContentPane().add(panel, 0);
			panel.setVisible(true);
		}
		if (e.getSource() == bLoc) {
			ventana.escribir("GET_LOC" + '\n');
			String respuesta = ventana.leer();
			JOptionPane.showMessageDialog(null, respuesta,
					"Ubicacion de la foto ", JOptionPane.INFORMATION_MESSAGE);
			this.setVisible(false);
			PanelMenu panel = new PanelMenu();
			ventana.getContentPane().add(panel, 0);
			panel.setVisible(true);
		}
	}
}